/*
 * PlaylistPopupMenu.java
 *
 * Created on April 8, 2006, 2:04 PM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */
package com.bff.slimserver.musicjukebox.ui.components;

import com.bff.slimserver.musicjukebox.lib.JukeboxProperties;
import com.bff.slimserver.musicjukebox.lib.actions.SavedPlaylistRemoveSongAction;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JFrame;
import javax.swing.JMenuItem;
import javax.swing.JPopupMenu;
import org.bff.slimserver.SlimSavedPlaylistManager;
import org.bff.slimserver.exception.SlimConnectionException;
import org.bff.slimserver.musicobjects.SlimPlaylistItem;
import org.bff.slimserver.musicobjects.SlimSavedPlaylist;

/**
 *
 * @author Bill
 */
public class SavedPlaylistPopupMenu extends JPopupMenu {

    private SlimSavedPlaylistManager playlistManager;
    private SlimSavedPlaylist playlist;
    private JMenuItem removePlaylistMenuItem;
    private SlimPlaylistItem object;
    
    /** Creates a new instance of PlaylistPopupMenu */
    public SavedPlaylistPopupMenu(SlimSavedPlaylist playlist,
            SlimPlaylistItem object) {
        try {
            this.playlistManager = JukeboxProperties.getInstance().getPlaylistManager();
        } catch (SlimConnectionException ex) {
            Logger.getLogger(SavedPlaylistPopupMenu.class.getName()).log(Level.SEVERE, null, ex);
        }
        this.object = object;
        this.playlist = playlist;
        createMenuItems();
    }

    private void createMenuItems() {
        //remove from playlist
        removePlaylistMenuItem = new JMenuItem(new SavedPlaylistRemoveSongAction(playlist, object));
        add(removePlaylistMenuItem);
    }
}
